
// @Bind #btnQuery.onClick
!function(self, arg, tabs) {
	var dsPart = view.id("dsPart");
	var entity = view.id("partForm").get("entity");
	// 设置查询条件
	dsPart.set("parameter", {
		drawingId : entity.drawingId,
		partName : entity.partName,
		partType : entity.partType,
		productDeptUid : entity.productDeptUid
		
	});
	
	dsPart.flush();
	
	//dsPart.getData().toArray().length
	var part = dsPart.getData('#');
	if(part){
		tabs.get("currentTab").set("path", "view.basicdata.Part.d?partUid=" + part.get("uuid"));
		tabs.set("currentIndex", 0);
	}
}

// @Bind #dgPartList.onDataRowClick
!function(self, arg) {
	var dsPart = view.id("dsPart");
	var partSelect = dsPart.getData("#");
	var tabs = view.id("tabs");
	var tab = tabs.get("currentTab");
	if(tab.get("name") == "partInfo"){
		tab.set("path", "view.basicdata.Part.d?partUid=" + partSelect.get("uuid"));
	}else if(tab.get("name") == "routingInfo"){
		tab.set("path", "view.basicdata.Routing.d?partUid=" + partSelect.get("uuid"));
		//tab.set("path", "view.basicdata.Routing.d?partUid=CFBD5898640848DEAF2C9B6AA4C41480");
	}
}

//@Bind #tabs.onTabChange
!function(self, arg) {
	var dsPart = view.id("dsPart");
	var partSelect = dsPart.getData("#");
	if(partSelect){
		var tab = arg.newTab;
		if(tab.get("name") == "partInfo"){
			tab.set("path", "view.basicdata.Part.d?partUid=" + partSelect.get("uuid"));
		}else if(tab.get("name") == "routingInfo"){
			tab.set("path", "view.basicdata.Routing.d?partUid=" + partSelect.get("uuid"));
			//tab.set("path", "view.basicdata.Routing.d?partUid=CFBD5898640848DEAF2C9B6AA4C41480");
		}
	}
}

// @Bind #dpModelClass.beforeExecute
!function(self, arg) {
	var dataSet = view.id("dsClassInformation");
	dataSet.set("parameter", {
		parentClassUid : "Sort1_Sort1"
	});
	dataSet.flush();

}

// @Bind #modelClassTree.onDataRowClick
!function(self, arg) {
	var dropDown = dorado.widget.DropDown.findDropDown(self);
	var node = self.get("currentNode");

	dropDown.close(node.get("data"));

}

// @Bind #deptTree.onDataRowClick
!function(self, arg) {
	var dropDown = dorado.widget.DropDown.findDropDown(self);
	var node = self.get("currentNode");

	dropDown.close(node.get("data"));
}

// @Bind #dpPartType.beforeExecute
!function(self, arg) {
	var dataSet = view.id("dsClassInformation");
	dataSet.set("parameter", {
		parentClassUid : "Sort1_Sort1"
	});
	dataSet.flush();
}

// @Bind #dpProductDept.beforeExecute
!function(self, arg) {
	var dataSet = view.id("dsDept");
	var user = view.id("dsUser").getData("#");
	
	dataSet.set("parameter", user.get("deptUid"));
	dataSet.flush();
}

// @Bind #partTypeTree.onDataRowClick
!function(self, arg) {
	var dropDown = dorado.widget.DropDown.findDropDown(self);
	var node = self.get("currentNode");

	dropDown.close(node.get("data"));

}
